<template>
    <div class="child">
        <h1>{{msg}}</h1>
        <ul>
            <li v-for="item,index in allList" :key="item.name" @click="send(item.title)">{{item.title}}</li>
        </ul>
    </div>
</template>
// <script>
import {defineProps,reactive,toRefs,defineEmits} from 'vue'
defineProps({
    msg:{
        type:String,
        default:'我是子组件默认的数据',
        // required:true
    }
})
const data = reactive({
    allList:[{title:'三国杀',name:'关羽'},{title:'王者',name:'杨戬'},{title:'英雄联盟',name:'杨戬'}]
})
const {allList} = toRefs(data)
const emits = defineEmits(['abc'])
const send = (title)=>{
    emits('abc',title)
}

</script>


